/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.edinet.agencialinea3.ejb.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author ivan
 */
@Entity
@Table(name = "GUIAS_DESPACHO")
@NamedQueries({
    @NamedQuery(name = "GuiasDespacho.findAll", query = "SELECT g FROM GuiasDespacho g"),
    @NamedQuery(name = "GuiasDespacho.findByNumeroGuia", query = "SELECT g FROM GuiasDespacho g WHERE g.numeroGuia = :numeroGuia"),
    @NamedQuery(name = "GuiasDespacho.findByFechaGuia", query = "SELECT g FROM GuiasDespacho g WHERE g.fechaGuia = :fechaGuia"),
    @NamedQuery(name = "GuiasDespacho.findByDespParcial", query = "SELECT g FROM GuiasDespacho g WHERE g.despParcial = :despParcial"),
    @NamedQuery(name = "GuiasDespacho.findByTransportista", query = "SELECT g FROM GuiasDespacho g WHERE g.transportista = :transportista")})
public class GuiasDespacho implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "NUMERO_GUIA")
    private BigDecimal numeroGuia;
    @Column(name = "FECHA_GUIA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaGuia;
    @Column(name = "DESP_PARCIAL")
    private BigInteger despParcial;
    @Size(max = 50)
    @Column(name = "TRANSPORTISTA")
    private String transportista;
    @JoinColumn(name = "NUMERO_DESPACHO", referencedColumnName = "NUMERO_DESPACHO")
    @ManyToOne(optional = false)
    private Declaracion numeroDespacho;

    public GuiasDespacho() {
    }

    public GuiasDespacho(BigDecimal numeroGuia) {
        this.numeroGuia = numeroGuia;
    }

    public BigDecimal getNumeroGuia() {
        return numeroGuia;
    }

    public void setNumeroGuia(BigDecimal numeroGuia) {
        this.numeroGuia = numeroGuia;
    }

    public Date getFechaGuia() {
        return fechaGuia;
    }

    public void setFechaGuia(Date fechaGuia) {
        this.fechaGuia = fechaGuia;
    }

    public BigInteger getDespParcial() {
        return despParcial;
    }

    public void setDespParcial(BigInteger despParcial) {
        this.despParcial = despParcial;
    }

    public String getTransportista() {
        return transportista;
    }

    public void setTransportista(String transportista) {
        this.transportista = transportista;
    }

    public Declaracion getNumeroDespacho() {
        return numeroDespacho;
    }

    public void setNumeroDespacho(Declaracion numeroDespacho) {
        this.numeroDespacho = numeroDespacho;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numeroGuia != null ? numeroGuia.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GuiasDespacho)) {
            return false;
        }
        GuiasDespacho other = (GuiasDespacho) object;
        if ((this.numeroGuia == null && other.numeroGuia != null) || (this.numeroGuia != null && !this.numeroGuia.equals(other.numeroGuia))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.edinet.agencialinea3.ejb.entity.GuiasDespacho[ numeroGuia=" + numeroGuia + " ]";
    }
    
}
